import platformRequest from "@/utils/platformRequest";

export const getCustomById = (id:number) =>
  platformRequest({
    url:`/customer/${id}`,
    method:'get'
  })

export const addCustom = (body:object) =>
  platformRequest.post('/customer', body)

export const updateCustom = (body:object) =>
  platformRequest.put('/customer', body)

export const deleteCustoms = (ids:number[]) =>
  platformRequest.delete('/customer?ids='+ids.join(','))

export const getCustomInfo = (customerName:string, page:number, pageSize:number, status:number) =>
  platformRequest({
    url:'/customer/page',
    method:'get',
    params:{
      customerName,
      page,
      pageSize,
      status
    }
  })

export const updateCustomerStatus = (params: { status:number, id:number }) =>
  platformRequest.post(`/customer/status/${params.status}?id=${params.id}`)
